﻿using Sustainalytics.Ai.HbaseRepository;
using System;
using System.Collections.Generic;
using System.Configuration;
using Xunit;

namespace Sustainalytics.ClientDW.Synchronization.SyncESGData.Tests
{
    public class CoreEsgConnectorTests
    {
        private readonly HbaseConfiguration _HBaseConfiguration = new HbaseConfiguration
        {
            ThriftServerAddress = ConfigurationManager.AppSettings["HBaseThriftServer"],
            ThriftPort = int.Parse(ConfigurationManager.AppSettings["HBaseThriftPort"]),
            PhoenixPassword = ConfigurationManager.AppSettings["PhoenixPassword"],
            PhoenixServerAddress = ConfigurationManager.AppSettings["PhoenixServerUrl"],
            PhoenixVnetMode = bool.Parse(ConfigurationManager.AppSettings["PhoenixVnetMode"]),
            PhoenixUser = ConfigurationManager.AppSettings["PhoenixUser"]
        };

        [Fact]
        public void GetDataByDateTime()
        {
            ResearchDataProvider.ResearchDataProvider researchData = new ResearchDataProvider.ResearchDataProvider(_HBaseConfiguration);
            var resData = researchData.GetEsgResearchProfile(ResearchDataProvider.Models.Analyst_Interface.FrameworkCodes.FocusedRatings, new DateTime(2016, 10, 13));
            Assert.NotNull(resData);
        }

        [Fact]
        public void GetDataByCapitalIqId()
        {
            ResearchDataProvider.ResearchDataProvider researchData = new ResearchDataProvider.ResearchDataProvider(_HBaseConfiguration);
            var resData = researchData.GetEsgResearchProfile(ResearchDataProvider.Models.Analyst_Interface.FrameworkCodes.FocusedRatings, new List<Guid>() { Guid.Parse("7caffc7e-f27f-4b1d-94b6-23f0404a01fa") });
            Assert.NotNull(resData);
        }
    }
}
